﻿using UnityEngine;
using System.Collections;


public class Tile : MonoBehaviour
{
    public int m_iIndex = 0;
    public int m_iOption = 0;
    public bool m_bInvisible = true;

    IEnumerator Start()
    {
        StartCoroutine("Progress");
        m_bInvisible = true;

        yield return null;
    }

    IEnumerator Progress()
    {
        while (true)
        {
            if (!m_bInvisible)
            {
                if (m_iOption == 0)
                    gameObject.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0.25f);
                else if (m_iOption == 1)
                    gameObject.GetComponent<SpriteRenderer>().color = new Color(1, 0, 0, 0.25f);
                else if (m_iOption == 2)
                    gameObject.GetComponent<SpriteRenderer>().color = new Color(1, 1, 0, 0.25f);
                else if (m_iOption == 3)
                    gameObject.GetComponent<SpriteRenderer>().color = new Color(0, 1, 0, 0.25f);
                else if (m_iOption == 4)
                    gameObject.GetComponent<SpriteRenderer>().color = new Color(0, 0, 1, 0.25f);
                else if (m_iOption == 5)
                    gameObject.GetComponent<SpriteRenderer>().color = new Color(0, 1, 1, 0.25f);
            }
            else
            {
                if (m_iOption == 0)
                    gameObject.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0);
                else if (m_iOption == 1)
                    gameObject.GetComponent<SpriteRenderer>().color = new Color(1, 0, 0, 0);
                else if (m_iOption == 2)
                    gameObject.GetComponent<SpriteRenderer>().color = new Color(1, 1, 0, 0);
                else if (m_iOption == 3)
                    gameObject.GetComponent<SpriteRenderer>().color = new Color(0, 1, 0, 0);
                else if (m_iOption == 4)
                    gameObject.GetComponent<SpriteRenderer>().color = new Color(0, 0, 1, 0);
                else if (m_iOption == 5)
                    gameObject.GetComponent<SpriteRenderer>().color = new Color(0, 1, 1, 0);
            }
            

            yield return null;
        }


    }
}
 